import request from "@/axios/request";
import url from "@/axios/url";
const { adminUrl } = url();

//获取角色列表
export function getRoleList(params = {}) {
  return request({
    url: `${adminUrl}role/listNew`,
    method: "get",
    params,
  });
}

//获取岗位列表
export function getPostList(params = {}) {
  return request({
    url: `${adminUrl}post/select`,
    method: "get",
    params,
  });
}
export function getBaseCodeStrategy(params = {}) {
  return request({
    url: `${adminUrl}baseCodeStrategy/list`,
    method: "get",
    params,
  });
}
// 获取数据字典
export function getDict(type = "") {
  return request({
    url: `${adminUrl}dict/type/` + type,
    method: "get",
  });
}

// 查询系统列表
export function getSystemList() {
  return request({
    url: `${adminUrl}baseModuleInfo/system`,
    method: "get",
  });
}

// 查询模块列表
export function getModuleList() {
  return request({
    url: `${adminUrl}baseModuleInfo/module`,
    method: "get",
  });
}

// 查询系统/模块级联下拉
export function getSysModuleCascader() {
  return request({
    url: `${adminUrl}baseModuleInfo/sysModule`,
    method: "get",
  });
}

// 删除文件
export function deleteFile(url, params = {}) {
  return request({
    url: url,
    method: "delete",
    params,
  });
}

// 获取用户页面资源-到按钮级别
export function resourceWithBs(params) {
  return request({
    url: `${adminUrl}resource/resourceWithBs`,
    method: "get",
    params,
  });
}
// 获取计量单位数据字典
export function getUnitDictList() {
  return request({
    url: `${adminUrl}baseUnitConversion/list`,
    method: "get",
  });
}
// 修改数据字典详情项
export function putAuthDictItem(data = {}) {
  return request({
    url: `${adminUrl}dict/item`,
    method: "put",
    data,
  });
}
//
export function listByConfigRole(params) {
  return request({
    url: `${adminUrl}commonTemplateConfig/listByConfigRole`,
    method: "get",
    params: {
      useType: "pc",
      ...params,
    },
  });
}
// 查询模板
export function getInfoByCode(params) {
  return request({
    url: `${adminUrl}system/template/getInfoByCode`,
    method: "get",
    params,
  });
}
